#include <string>
#include <map>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <list>
#include <exception>
#include <conio.h>

#ifndef UTILS_H
#define UTILS_H


/**
 * \typedef	unsigned char BYTE
 *
 * \brief	Defines an alias representing the byte .
**/
typedef unsigned char	BYTE; 

/**
 * \typedef	unsigned short WORD
 *
 * \brief	Defines an alias representing the word .
**/
typedef unsigned short	WORD;

/**
 * \typedef	unsigned int DWORD
 *
 * \brief	Defines an alias representing the dword .
**/
typedef unsigned int	DWORD;

/**
 * \typedef	int LONG
 *
 * \brief	Defines an alias representing the long .
**/
typedef int				LONG;

/**
 * \typedef	float REAL
 *
 * \brief	Defines an alias representing the real .
**/
typedef float			REAL;

/**
 * \brief	Gets.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param [in,out]	b	  	The.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool get(std::istream &stream, BYTE &b);

/**
 * \brief	Puts.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param	b			  	The.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool put(std::ostream &stream, const BYTE &b);

/**
 * \brief	Gets.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param [in,out]	w	  	The w.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool get(std::istream &stream, WORD &w);

/**
 * \brief	Puts.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param	w			  	The w.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool put(std::ostream &stream, const WORD &w);

/**
 * \brief	Gets.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param [in,out]	dw	  	The dw.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool get(std::istream &stream, DWORD &dw);

/**
 * \brief	Puts.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param	dw			  	The dw.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool put(std::ostream &stream, const DWORD &dw);

/**
 * \brief	Gets.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param [in,out]	l	  	The.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool get(std::istream &stream, LONG &l);

/**
 * \brief	Puts.
 *
 * \author	rsiancas
 * \date	3/28/2011
 *
 * \param [in,out]	stream	The stream.
 * \param	l			  	The.
 *
 * \return	true if it succeeds, false if it fails.
**/

bool put(std::ostream &stream, const LONG &l);

/**
 * \brief	Color palette entry. 
 *
 * \author	rsiancas
 * \date	3/28/2011
**/

struct ColorPaletteEntry{						
		
		BYTE rgbRed;	///< The rgb red component
		BYTE rgbGreen;	///< The rgb green component
		BYTE rgbBlue;	///< The rgb blue component
};

/**
 * \brief	General information about the Bitmap Image File 
 *
 * \author	rsiancas
 * \date	3/28/2011
**/

struct BITMAPFILEHEADER{
	
	WORD bfType;		///< The Header field used to identify the BMP file 
	DWORD bfSize;		///< The size of the BMP file in bytes
	DWORD bfReserved;	///< Actual value depends on the application that creates the image
	DWORD bfOffBits;	///< The offset of the byte where the bitmap image data (Pixel Array) can be found.
};

/**
 * \brief	detailed information about the bitmap image and define the pixel format. 
 *
 * \author	rsiancas
 * \date	3/28/2011
**/

struct BITMAPINFOHEADER {
	
	DWORD biSize;			///< Size of the header
	LONG biWidth;			///< The bitmap width in pixels
	LONG biHeight;			///< The bitmap height in pixels
	WORD biPlanes;			///< The number of color planes being used.
	WORD biBitCount;		///< The number of bits per pixel, which is the color depth of the image.
	DWORD biCompression;	///< The compression method being used.
	DWORD biSizeImage;		///< The image size. This is the size of the raw bitmap data and should not be confused with the file size.
	LONG biXPelsPerMeter;	///< The horizontal resolution of the image. (pixel per meter)
	LONG biYPelsPerMeter;	///< The vertical resolution of the image. (pixel per meter)
	DWORD biClrUsed;		///< the number of colors in the color palette, or 0 to default to 2^n
	DWORD biClrImportant;	///< the number of important colors used, or 0 when every color is important; generally ignored
};
	

#endif